home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Programming / AmigaE / Src / OOmodules / library / locale / testObjectString.e < prev   
Encoding:
Text File  |  1996-09-21  |  1.4 KB  |  87 lines

  1. /*
  2.  
  3. Short sample program for the locale object.
  4.  
  5. */
  6.  
  7.  
  8.  
  9. MODULE  'oomodules/library/locale',
  10.         'oomodules/object',
  11.         'oomodules/sort/string'
  12.  
  13.  
  14.  
  15. PROC main()
  16. DEF locale:PTR TO locale,
  17.     object:PTR TO object,
  18.     string:PTR TO string
  19.  
  20.  
  21.  /*
  22.   * Allocate objects. The string object is needed in getObjectString()
  23.   */
  24.  
  25.   NEW string.new()
  26.   NEW object.new()
  27.  
  28.  
  29.  
  30.  /*
  31.   * Open the term catalog with builtin language english
  32.   */
  33.  
  34.   NEW locale.new(["ctlg", 'term.catalog'])
  35.   IF locale.catalog
  36.  
  37.  
  38.  
  39.    /*
  40.     * Get the frist three strings and print them.
  41.     */
  42.  
  43.     WriteF('Here are some strings from term\as catalog:\n\n')
  44.     WriteF('\s\n\s\n\s\n', locale.getString(1,'bla'),
  45.            locale.getString(2,'bla'),
  46.            locale.getString(3,'bla'))
  47.  
  48.  
  49.  
  50.   ELSE
  51.  
  52.     RETURN
  53.  
  54.   ENDIF
  55.  
  56.  
  57.  
  58.   WriteF('\n\n')
  59.   WriteF('Now you\all get a string from the object\as catalog:\n\n')
  60.  
  61.  
  62.  
  63.  /*
  64.   * Get a string from the object's catalog and set the string object to it.
  65.   * Currently that string is retrieved from the catalog
  66.   * oomodules/object.catalog.
  67.   */
  68.  
  69.   locale.getObjectString(object,string, 1,'bla')
  70.   WriteF('\s\n', string.write())
  71.  
  72.  
  73.  
  74.  /*
  75.   * Get back to term's catalog.
  76.   */
  77.  
  78.   WriteF('\n\n')
  79.   WriteF('Here are some strings from term\as catalog again:\n\n')
  80.   WriteF('\s\n\s\n\s\n', locale.getString(1,'bla'),
  81.          locale.getString(2,'bla'),
  82.          locale.getString(3,'bla'))
  83.  
  84.  
  85.  
  86. ENDPROC
  87.